package week8;




import java.util.Deque;
import java.util.LinkedList;
import java.util.Scanner;
public class Duilie {
  
  public static void main(String[] args){
	  Scanner sc=new Scanner(System.in);
	  Deque<Integer> a=new LinkedList<>();
	  Deque<Integer> b=new LinkedList<>();
	  int n=sc.nextInt();
	  for(int i=0;i<n;i++){
		  int s=sc.nextInt();
		  if(s%2==0){
			  b.addLast(s);
		  }
		  else{
			  a.addLast(s);
		  }
	  }
	  while(!quA.isEmpty()){
		  for(int i=0;i<quA.size()-1;i++){
			  System.out.println(quA.poll()+" ");
		  }
	  }
	  while(!quB.isEmpty()){
		  for(int i=0;i<quB.size()-1;i++){
			  System.out.println(quB.poll()+" ");
		  }
	  }
  }
  
}
